﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TurnamentOrganizer
{
    public partial class LocationForm : Form
    {
        Tournament _main;

        public LocationForm(Tournament main)
        {
            this._main = main;
            InitializeComponent();
            listBoxLocations.DataSource = main.Locations;
        }

        private void buttonAddLocations_Click(object sender, EventArgs e)
        {
            _main.Locations.Add(textBoxNewLocation.Text);
        }

        private void buttonRemoveSelected_Click(object sender, EventArgs e)
        {
            if (listBoxLocations.SelectedItem != null)
            {
                _main.Locations.Remove(listBoxLocations.SelectedItem.ToString());
            }
        }
    }
}
